﻿<?php
//连接数据库操作
include 'conn_mysql.php';
session_start();
$phone=$_SESSION['phone'];
$openid=$_SESSION['openid'];

$_FILES["file"]["name"] = date("Y-m-d") . rand() . ".png"; 
$i=move_uploaded_file($_FILES["file"]["tmp_name"],"picture1/" . $_FILES["file"]["name"]);

//将图片路径保存到相应位置
if(strlen($phone)!=0){
	$sql="UPDATE `ecs_users` SET `wx_touxiang`='"."picture1/" . $_FILES["file"]["name"]."' WHERE mobile_phone='$phone'";
}
if(strlen($openid)!=0){
	$sql="UPDATE `ecs_users` SET `wx_touxiang`='"."picture1/" . $_FILES["file"]["name"]."' WHERE openid='$openid'";
}
$query = mysql_query($sql);

?>
<SCRIPT LANGUAGE="javascript"> 
	//alert("<?php echo $bigtype2;?>"+" 内容"+"<?php echo $is_add2;?>");
	window.location.href="log_gerenzhongxing1.php"; 
</SCRIPT>
<body class="body_css" id="body" >
</body>